export let mail = {
  namespaced: true,
  state: {
    mail_data: {},
  },
  actions: {
    getMailData(store, data = {}) {
      let url = "/login?email=" + data.email + "&password=" + data.password;

      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit("setMailData", data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            // 请求已发出，但服务器响应的状态码不在 2xx 范围内
            reject(error.response.data)
          }
        });
      })
    },
  },
  mutations: {
    setMailData(state, data) {
      state.mail_data = data;
    },
  }
}
